package com.qianfeng.zhangwei.day28;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.qianfeng.zhangwei.day28.widget.RoundProgressBar;
import com.qianfeng.zhangwei.day28.widget.TestView;

/**
 * 自定义View
 * 事件分发
 * 什么叫自定义view 继承View或者View的子类的View叫自定View
 */
public class MainActivity extends AppCompatActivity {
    TestView testView;
    private RoundProgressBar progressBar;
    private int progress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        testView = (TestView) this.findViewById(R.id.testView);
        progressBar = (RoundProgressBar) this.findViewById(R.id.roundProgressBar);
        progressBar.setMax(100);
        new Thread() {
            @Override
            public void run() {
                while (progress < 100) {
                    progress += 1;
                    progressBar.setProgress(progress);
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }.start();


    }

}
